package cn.net.qinling.healthcare.test.datagen;

import java.util.List;

import org.openhealthtools.mdht.uml.cda.CDAFactory;
import org.openhealthtools.mdht.uml.cda.Organization;
import org.openhealthtools.mdht.uml.hl7.datatypes.DatatypesFactory;
import org.openhealthtools.mdht.uml.hl7.datatypes.ON;

import cn.net.qinling.healthcare.CDARootIdentifiers;

public class OrganizationGenerator extends Generator<Organization> {

	public OrganizationGenerator(Selector selector) {
		super(selector);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected Organization doGeneration() {
		List<String> selectedInfo = selector.next(CDARootIdentifiers.HCPROVIDER_ORGANIZATION);
		
		
		Organization org = CDAFactory.eINSTANCE.createOrganization();
		org.getIds().add(
				DatatypesFactory.eINSTANCE.createII(
						CDARootIdentifiers.HCPROVIDER_ORGANIZATION,
						selectedInfo.get(1)));
		ON organizationName = DatatypesFactory.eINSTANCE.createON();
		organizationName.addText(selectedInfo.get(2).trim());
		//System.out.println(selectedInfo.get(2));
		org.getNames().add(organizationName);
		return org;
	}

}
